package com.junzhiit.nengji.api.web.util;


import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import javax.servlet.ServletOutputStream;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class ReleaseResourceUtil {

	private final static Log logger = LogFactory.getLog(FileUtil.class);
	
	public ReleaseResourceUtil() {
		
	}
	
	public static void closeFileInputStream(FileInputStream fis) {
		if(fis != null){
			try {
				fis.close();
			} catch (IOException e) {
				logger.error(e.getMessage(), e);
			}
		}
	}
	
	public static void closeFileOutputStream(FileOutputStream fos) {
		if(fos!=null){
			try {
				fos.close();
			} catch (IOException e) {
				logger.error(e.getMessage(), e);
			}
		}
	}
	
	public static void closeBufferedInputStream(BufferedInputStream bis) {
		if(bis!=null){
			try {
				bis.close();
			} catch (IOException e) {
				logger.error(e.getMessage(), e);
			}
		}
	}
	
	public static void closeBufferedOutputStream(BufferedOutputStream bos) {
		if(bos!=null){
			try {
				bos.close();
			} catch (IOException e) {
				logger.error(e.getMessage(), e);
			}
		}
	}
	
	public static void closeInputStream(InputStream is) {
		if(is!=null){
			try {
				is.close();
			} catch (IOException e) {
				logger.error(e.getMessage(), e);
			}
		}
	}
	
	public static void closeOutputStream(OutputStream os) {
		if(os!=null){
			try {
				os.close();
			} catch (IOException e) {
				logger.error(e.getMessage(), e);
			}
		}
	}
	
	public static void closeServletOutputStream(ServletOutputStream sos) {
		if(sos!=null){
			try {
				sos.close();
			} catch (IOException e) {
				logger.error(e.getMessage(), e);
			}
		}
	}
}
